package com.example.shinelonx6.lyqapplication;

import android.animation.ObjectAnimator;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

/**
 * Created by Shinelon X6 on 2017/10/17.
 */
public class Anim extends Activity {
    private TextView tv_scale;
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.layout);
        tv_scale = (TextView) findViewById(R.id.scale);
    }
    public void startzoom(View v){
        //缩放
        ObjectAnimator scaleAnimator_x = ObjectAnimator.ofFloat(tv_scale,View.SCALE_X,1,0,1);
        scaleAnimator_x.setDuration(1000*2);
        ObjectAnimator scaleAnimator_y = ObjectAnimator.ofFloat(tv_scale, View.SCALE_Y,1,0,1);
        scaleAnimator_y.setDuration(1000*2);
        scaleAnimator_x.start();
        scaleAnimator_y.start();
    }
     public void startdisplacement(View v){
         //位移
         ObjectAnimator transation_x = ObjectAnimator.ofFloat(tv_scale,View.TRANSLATION_X,0,100,0);
         transation_x.setDuration(1000*5);
         ObjectAnimator transation_y = ObjectAnimator.ofFloat(tv_scale,View.TRANSLATION_Y,0,100,0);
         transation_y.setDuration(1000*5);
         transation_x.start();
         transation_y.start();
     }
    public void startrotation(View v){
        //旋转
        ObjectAnimator rotation_x = ObjectAnimator.ofFloat(tv_scale,View.ROTATION_X,0,100,0);
        rotation_x.setDuration(1000*2);
        ObjectAnimator rotation_y = ObjectAnimator.ofFloat(tv_scale,View.ROTATION_Y,0,100,0);
        rotation_y.setDuration(1000*2);
        ObjectAnimator rotation = ObjectAnimator.ofFloat(tv_scale,View.ROTATION,0,100,0);
        rotation.setDuration(1000*5);
        rotation_x.start();
        rotation_y.start();
    }
    public void starttransparency(View v){
        //透明度
        ObjectAnimator alpha = ObjectAnimator.ofFloat(tv_scale,View.ALPHA,3,0,3);
        alpha.setDuration(1000*5);
        alpha.start();
    }
}

